/**
日期选择

将iosComponent="selDate" 的容器初始化为往来单位控件

<div iosComponent="selDate" id="xxx"></div>
*/

(function($){ 
	$.fn.selDate = function(options) { 
		//默认参数
		var defaults = { 
		}; 
		var opts = $.extend({}, defaults, options);  
		var curDate = new Date();
		var m = curDate.getMonth() + 1;    
		var d = curDate.getDate();
		var y = curDate.getYear();     
		//逻辑代码
		return this.each(function(){
			
			var year = "<option>"+y+"</option>"+"<option>"+(y-1)+"</option>";
			var month = "";
			for(var i=1;i<13;i++){
				month += "<option "+(i==m?"selected":"")+">"+(i<10?("0"+i):i)+"</option>";
			}
			var day = "";
			for(var i=1;i<32;i++){
				day += "<option "+(i==d?"selected":"")+">"+(i<10?("0"+i):i)+"</option>";
			}
			var inserthtml = $("<div class='ios_component_date'><table><tr><td class='component_date_up'>"+$(this).attr("label")+"</td></tr><tr class='component_date_select'><td style='border:1px solid #ccc'><select>"+year+"</select><select>"+month+"</select><select>"+day+"</select></td></tr></table></div>");
			inserthtml.click(function(event){
			});
			$(this).append(inserthtml);
			
		}); 
	}; 
}
)(jQuery); 

$(function(){
	$("div[iosComponent=sel_date]").selDate();
})
